<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = 'abcdefg';
        var arr = '';
        for(var i = str.length - 1; i >= 0 ; i--){
            arr += str[i];
        }
        console.log(arr);
        
    </script>
</body>
</html>